<template>
	<view class="body">
		<nodata class="noData" v-if="isData"></nodata>

		<view class="list_car" v-for="(item,index) in  listData" :key="index">
			<view class="content">
				<view class="title">
					<view class="title_line"></view>
					<text class="item_title">{{item.vehCode}}</text>
				</view>
				<view class="line"></view>
				<view class="itme_text">
					<view class="text_left">道路运输证号</view>
					<view class="text_right">{{item.ccertId}}</view>
				</view>
				<view class="line"></view>
				<view class="itme_text">
					<view class="text_left">下次年审日期</view>
					<view class="text_right">{{dateFormat(new Date(item.nextCheckDate),'YYYY-mm-dd')}}</view>
				</view>
				<view class="line"></view>
				<view class="itme_text">
					<view class="text_left">有效期至</view>
					<view class="text_right">{{dateFormat(new Date(item.expireDate),'YYYY-mm-dd')}}</view>
				</view>
				<view class="line"></view>
				<view class="itme_text">
					<view class="text_left">发证机关</view>
					<view class="text_right">{{item.grantDepartment}}</view>
				</view>

				<view class="line"></view>
				<view class="itme_text">
					<view class="text_left">经营范围</view>
					<view class="text_right">{{item.mgrArea}}</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import nodata from '@/components/nodata.vue';
	import store from "@/store/index.js";
	import {dateFormat} from '@/common/util.js'
	export default {
		data() {
			return {
				isData: false,
				listData: []
			};
		},
		mounted() {
			console.log( store.getters.getEmpIdCard,'111111111')
			
			//获取车辆信息
			this.getCars();
		},
		components: {
			nodata
		},
		methods: {
			//获取车辆信息
			getCars() {
				if (store.getters.getUserType == 1) {
					this.$api.myCarJy({
						'idNumber': store.getters.getEmpIdCard
					}).then(res => {
						console.log(res)
						if (res.data['code'] == 200) {
							this.listData = res.data['data']
							if (this.listData.length == 0) {
								this.isData = true
							}
						}
					}).catch(res => {

					});
				} else {
					this.$api.myCarQy({}).then(res => {
						console.log(res)
						if (res.data['code'] == 200) {
							this.listData = res.data['data']
							if (this.listData.length == 0) {
								this.isData = true
							}
						}
					}).catch(res => {

					});

				}
			},
			dateFormat,
		}
	}
</script>

<style lang="scss">
	.body {
		padding: 20rpx 0;
		.noData {
			padding-top: 500rpx;
			margin: 0rpx auto;

		}

		.content {
			margin: 0 20rpx 20rpx;
			background-color: #FFFFFF;
			border-radius: 20rpx;
			padding-top: 10rpx;
			padding-bottom: 10rpx;


			.title {
				padding-top: 25rpx;
				padding-bottom: 25rpx;
				display: flex;
				align-items: center;

				.title_line {
					width: 5rpx;
					height: 50rpx;
					background-color: $app-color;
				}

				.item_title {
					margin-left: 30rpx;
					font-size: 35rpx;
				}

			}

			.line {
				height: 1rpx;
				background-color: #F2F2F2;
				margin-left: 20rpx;
				margin-right: 20rpx;
			}

			.itme_text {
				display: flex;
				align-items: center;
				margin-left: 20rpx;
				padding-top: 25rpx;
				padding-bottom: 25rpx;

				.text_left {
					font-size: 32rpx;
					color: #666666;
				}

				.text_right {
					margin-left: 32rpx;
					font-size: 30rpx;
				}
			}
		}
	}
</style>
